<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/7
 * Time: 15:56
 */

namespace app\home\model;


use think\Model;

class Category extends Model
{
    public function getUrlAttr($value,$data)
    {
        if (!empty($data['url']))
        {
            return $value;
        } else {
            if ($data['type'] == 1)
            {
                $controller = 'News';
            } else {
                $controller = 'Info';
            }
            return url('home/'.$controller.'/index', ['id'=>$data['id']]);
        }
    }
}